package com.sky.mapper;

import com.sky.entity.OrderDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * TODO
 *
 * @Author yml
 * @Date2025/5/28 19:34
 */
@Mapper
public interface OrderDetailMapper {
    /**
     * 向订单明细表中添加多条数据
     * @param orderDetailList
     */
    void insertBatch(List<OrderDetail> orderDetailList);

    /**
     * 根据订单id查询订单明细
     * @param id
     * @return
     */
    List<OrderDetail> historyOrdersDetail(@Param("id") Long id);

    @Select("select * from order_detail where order_id=#{id}")
    List<OrderDetail> getByOrderId(Long id);

    /**
     * 根据订单id批量取消订单明细
     * @param id
     */
    void cancelBatch(@Param("id") Long id);

}
